import 'package:hive/hive.dart';

part 'scan_result_model.g.dart';

@HiveType(typeId: 8)
class ScanResultModel extends HiveObject {
  @HiveField(0)
  String id;

  @HiveField(1)
  String userId;

  @HiveField(2)
  String imageUrl;

  @HiveField(3)
  String result;

  @HiveField(4)
  String description;

  @HiveField(5)
  DateTime scanDate;

  @HiveField(6)
  bool isFavorite;

  ScanResultModel({
    required this.id,
    required this.userId,
    required this.imageUrl,
    required this.result,
    required this.description,
    required this.scanDate,
    this.isFavorite = false,
  });

  // 切换收藏状态
  void toggleFavorite() {
    isFavorite = !isFavorite;
  }
}
